package dao.gestionVente;

import java.util.List;

import modele.gestionVente.Enchere;

import org.hibernate.Session;

import dao.AbstractDAO;
import dao.HibernateUtil;

public class EnchereDAO extends AbstractDAO<Enchere>  {
	
	private static EnchereDAO DAO = new EnchereDAO();
	
	public static EnchereDAO getDAO()
	{
		return DAO;
	}
	
	public List<Enchere> retrieveActive()
	{
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        
        String hql = "from Enchere u WHERE u.active = true";
        List<Enchere> list = session.createQuery(hql)
		        	.list();
        
        session.getTransaction().commit();
        
        return list;
	}
}
